<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style type="text/css">
form {
	margin-bottom: 10px;
}

.formField {
	overflow: auto;
	width: 100%;
	margin: 5px 0;
}

label {
	min-width: 130px;
	float: left;
	display: block;
	margin-right: 5px;
	padding-left: 10px;
	text-transform: capitalize;
}

.formText {
	display: block;
	float: left;
}

body {
	background-image: url("image/body_bj.jpg");
	font-size: 12px;
}

.btn1 {
	width: 100px;
	height: 30px;
	background-color: #4e72b8;
	border-radius: 5px;
	font-size: 14px;
	color: white;
}
</style>
<script type="text/javascript">
	function check() {
		var name = document.getElementById("lastName").value;
		var price = document.getElementById("lastPrice").value;
		var detail = document.getElementById("txt").value;
		var rs = true;
		if (name == null || name == '') {
			rs = false;
		}
		if (price == null || price == '' || price == "只能输入正数和小数点哦！") {
			rs = false;
		}
		if (detail == null || detail == '') {
			rs = false;
		}
		if (rs == false) {
			alert("有选项未填写！请核对信息！")
		}
		return rs;
	}
</script>
</head>
<body>
	<div class="div1">
		<div style="text-align: center;">
			<h5>新增菜品</h5>
			<hr>
		</div>
		<form action="GoodsServlet" method="post" class="form" target="outer"
			onsubmit="return check()">
			<input type="hidden" name="op" value="2">
			<div class="formField clearfix">
				<label for="lastName">菜名:</label> <input type="text"
					class="formText" id="lastName" name="g_name" />
			</div>
			<div class="formField clearfix">
				<label for="lastName">价格:</label> <input type="text"
					class="formText" id="lastPrice" name="g_price"
					onkeyup="value=value.replace(/[^\d.]/g,'')" value="只能输入正数和小数点哦！"
					onfocus="this.value='';" />
			</div>
			<div class="formField clearfix">
				<label for="email">描述:</label>
				<textarea rows="2" cols="15" name="g_detail" id="txt"></textarea>
			</div>
			<div class="formField clearfix">
				<label for="blog">菜式:</label> <select name="g_type">
					<c:forEach items="${map.type}" var="x">
						<option value="${x.type_id}">${x.type}</option>
					</c:forEach>
				</select>
			</div>
			<hr>
			<div style="padding-left: 10px; text-align: center; margin: 0 auto;">
				<input type="submit" value="新增菜品" class="btn1">
			</div>
		</form>
	</div>
</body>
</html>